<?php

function adminfeature() {
?><img src="images/admin.gif" alt="Admin Feature"><?php
}

function cclass($class) {
  ?><img src="images/<?=$class?>.gif" alt="<?=$class?>.gif" title="<?=$class?>"><?php
}

function time_select() {
?>
<select name="hour">
<?php
$now = time();
$i = 1;
while($i <= 12) {
  $chk = "";
  if((date("g", $now))==$i) {
    $chk = " selected";
  }
?>
 <option value="<?=$i?>"<?=$chk?>><?=$i?> 
<?php
      $i++;
    }
?>
</select>
    :
<select name="minute">
<?php
$now = time();
 $i = 0;
while($i <= 59) {
  $chk = "";
  if((date("i", $now))==$i) {
    $chk = " selected";
  }
?>
 <option value="<?=$i?>"<?=$chk?>><? if ($i<10) { echo "0"; } ?><?=$i?> 
<?php
      $i++;
    }
?>
</select>
<select name="ampm">
<option value="am"<?php     if(date("a",$now)=="am") { echo " selected"; } ?>>am
<option value="pm"<?php     if(date("a",$now)=="pm") { echo " selected"; } ?>>pm
</select>
<?
}

function date_select($predate=0) {
  $now = time();
  if($predate>0) {
    $now = $predate;
  }
?>
<select name="month">
<?php
$mnt[0] = "January";
$mnt[1] = "February";
$mnt[2] = "March";
$mnt[3] = "April";
$mnt[4] = "May";
$mnt[5] = "June";
$mnt[6] = "July";
$mnt[7] = "August";
$mnt[8] = "September";
$mnt[9] = "October";
$mnt[10] = "November";
$mnt[11] = "December";
$i = 0;
while($i < 12) {
  $chk = "";
  if((date("n", $now))-1==$i) {
    $chk = " selected";
  }
?>
 <option value="<?=$i?>"<?=$chk?>><?=$mnt[$i]?> 

<?php
      $i++;
    }
?>
</select>

<select name="day">
<?php
$i = 1;
while($i <= 32) {
  $chk = "";
  if((date("j", $now))==$i) {
    $chk = " selected";
  }
?>
 <option value="<?=$i?>"<?=$chk?>><?=$i?> 
<?php
      $i++;
    }
?>
</select>

<select name="year">
<?php
$i = (date("Y", $now))-2;
while($i <= ((date("Y", $now)+2))) {
  $chk = "";
  if((date("Y", $now))==$i) {
    $chk = " selected";
  }
?>
 <option value="<?=$i?>"<?=$chk?>><?=$i?> 
<?php
      $i++;
    }
?>
</select>
<?php
}

?>
